package com.ansion.commonchat.startup.workmanager.bwork.impl.mode;

import com.ansion.commonchat.startup.workmanager.bwork.BData;
import com.ansion.commonchat.startup.workmanager.bwork.BWorkInfo;

import java.util.List;

/**
 * Created by wanghongjie on 2023/5/5
 * Describe : 使用WorkSpecs来描述待执行的Work
 */
public interface BWorkSpecDao {
    void insertWorkSpec(BWorkSpec workSpec);

    void delete(String id);

    BWorkSpec getWorkSpec(String id);

    void setState(BWorkInfo.State state, String ids);

    void setOutput(String id, BData output);

    BWorkInfo.State getState(String id);

    BWorkSpec.BWorkInfoPojo getWorkStatusPojoForId(String id);

    List<BWorkInfo> getWorkInfosForTag(String tag);

    List<BWorkSpec> getAllEligibleWorkSpecsForScheduling();

    /**
     * 用于跨表查询，BDependencyDao#hasCompletedAllPrerequisites
     * SELECT id FROM workspec WHERE state!= WorkTypeConverters.StateIds.SUCCEEDED
     */
    List<String> getAllUnSucceededWorkSpecIds();

    void logout();
}
